package com.example.springboot.mapper;

import com.example.springboot.pojo.Department;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


//部门dao
@Repository
@Mapper
public interface DepartmentMapper {


    // 查询
    List<Department> queryAll();

    Department queryDepartmentById(@Param("id")int id);


    // 增加
    int addDepartment(Department department);

    // 修改
    int updateDepartment(Department department);

    // 删除
    int deleteDepartment(@Param("id")int id);










/*    //模拟数据库中的数据
    private static Map<Integer, Department> departments = null;

    static {
        departments = new HashMap<Integer,Department>();    //创建一个部门表
        departments.put(101,new Department(101,"教学部"));
        departments.put(102,new Department(101,"市场部"));
        departments.put(103,new Department(101,"教研部"));
        departments.put(104,new Department(101,"运营部"));
        departments.put(105,new Department(101,"后勤部"));
    }

    



    //获取所有部门信息
    public Collection<Department> getDepartments(){
        return departments.values();
    }

    //通过id得到部门
    public Department getDepartmentById(Integer id){
        return departments.get(id); 
    }*/

}
